window.onload = function (){
    let divArr = document.querySelectorAll(".img-bg");
    // setInterval(function (){
    //     let day = new Date();
    //     let timeStr = day.toLocaleTimeString();
    //     for (let i = 0; i < divArr.length; i++) {
    //         let num = timeStr.charAt(i);
    //         if(num==":") continue;
    //         divArr[i].className = `img-bg img-${num}`;
    //     }
    // },1000)
    function setTime(){
        let day = new Date();
        let timeStr = day.toLocaleTimeString();
        for (let i = 0; i < divArr.length; i++) {
            let num = timeStr.charAt(i);
            if(num===":") continue;
            divArr[i].className = `img-bg img-${num}`;
        }
    }
    setTime();
    setInterval(setTime,1000)
}